<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	  <title>会员注册</title>
	  <link href="{STATIC_URL}css/yzm-member-login.css" rel="stylesheet" type="text/css" />
	  <script type="text/javascript" src="{STATIC_URL}js/jquery-1.8.2.min.js"></script>
	  <script type="text/javascript" src="{STATIC_URL}plugin/layer/layer.js"></script>
	  <script type="text/javascript" src="{STATIC_URL}js/register.js"></script>
	  <meta name="description" content="yzmcms会员注册" />
  </head>
  <body>

	    <div class="yzm-member-container yzm-register">
		    <div class="yzm-title">会员注册</div>
			<div class="yzm-form">
				<form action="" method="post" onsubmit="return checkall()">
					<ul>
						<li><input type="text" class="input" name="username" id="username" placeholder="请输入用户名" value=""></li>				 
						<li><input type="text" class="input"  name="email" id="email" placeholder="请输入电子邮箱" value=""></li>				 
						<li><input type="password" class="input"  name="password" id="password" placeholder="请输入密码" value=""></li>
						<li><input type="password" class="input"  name="password2" id="password2" placeholder="请输入确认密码" value=""></li>
						<li><input type="text" class="input code" name="code" placeholder="请输入验证码"><img src="{U('api/index/code')}" onclick="this.src=this.src+'?'" class="codeimg" title="看不清，换一张"></li>	
						<li><input type="submit" class="submit" name="dosubmit" value="同意以下协议并注册"></li>
						<li class="last_li"><input type="checkbox" checked="checked" value="1" id="agree" name="agree"/> <a onclick="show_protocol()" href="javascript:void(0);">点击阅读注册协议</a></li>
					</ul>
					<div class="yzmcms_bottom">已有账号？<a href="{U('login')}">点击登录</a>&nbsp;&nbsp;&nbsp; <a href="{U('member/reset/init')}" target="_blank" style="color:#959595;float: right">忘记密码？</a></div>
				</form>
			</div>
		</div>

		<div class="clearfix"></div>
		<div class="yzm_footer">
			<div class="container">
				<p>Powered by <a href="http://www.yzmcms.com" target="_blank">{YZMCMS_SOFTNAME}</a> © 2014-2020  版权所有</p>
			</div>
		</div>
		
		<script type="text/javascript">
		function checkname(){
			var res = false;
			if($("#username").val() != ''){
				$.ajax({   
					type: "post",   
					url: "{U('public_checkname')}",   
					dataType: "html",
					async: false,	
					data: "username="+$('#username').val(), 
					beforeSend: function(){
						$("#dosubmit").attr({ disabled: "disabled" });
					},				
					success: function(msg){  
					if(msg == '1'){
						$("#dosubmit").removeAttr("disabled");
						res = true;				  
					}else if(msg == '-1'){
						layer.msg('用户名已存在', {icon:2,time: 1000});
					}else if(msg == '0'){
						layer.msg('用户名格式不正确', {icon:2,time: 1000});
					}else{
						layer.msg('未知错误', {icon:2,time: 1000});
					}				 
					} 
				});
				return res;
			}else{
				layer.msg('用户名不能为空', {icon:2,time: 1000});
				return res;
			}		   
		}

		function checkemail(){
			 var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/; 
			 var res = false;
			 if(reg.test($("#email").val())){
			  $.ajax({   
				type: "post",   
				url: "{U('public_checkemail')}",   
				dataType: "html",
				async: false,	
				data: "email="+$('#email').val(), 
				beforeSend: function(){
					 $("#dosubmit").attr({ disabled: "disabled" });
				},				
				success: function(msg){  
				 if(msg == '1'){
					  $("#dosubmit").removeAttr("disabled");
					  res = true;		  			  
				 }else if(msg == '-1'){
					  layer.msg('电子邮箱已存在', {icon:2,time: 1000});
				 }else if(msg == '0'){
					  layer.msg('电子邮箱格式不正确', {icon:2,time: 1000});  
				 }else{
					  layer.msg('未知错误', {icon:2,time: 1000});
				 }				 
				} 
			  });
			   return res;
			 }else{
				  layer.msg('电子邮箱格式不正确', {icon:2,time: 1000});
				  return res;
			 }		   
		}
		
		
		function show_protocol(){
		   layer.open({
			  type: 1,
			  title: '会员注册协议',
			  skin: 'layui-layer-rim', 
			  area: ['550px', '320px'], 
			  content: '<div style="margin:15px 20px"><p >1、在本站注册的会员，必须遵守《互联网电子公告服务管理规定》，不得在本站发表诽谤他人，侵犯他人隐私，侵犯他人知识产权，传播病毒，政治言论，商业讯息等信息。</p><br><p>2、在所有在本站发表的文章，本站都具有最终编辑权，并且保留用于印刷或向第三方发表的权利，如果你的资料不齐全，我们将有权不作任何通知使用你在本站发布的作品。</p><br><p>3、在登记过程中，您将选择注册名和密码。注册名的选择应遵守法律法规及社会公德。您必须对您的密码保密，您将对您注册名和密码下发生的所有活动承担责任。</p></div>'
			});
		}
		</script>		
  </body>
</html>